package com.ruoyi.system.feign;

import com.ruoyi.system.feign.model.FeignTenantModel;
import com.ruoyi.system.feign.result.FeignDataResult;
import com.ruoyi.system.feign.result.FeignObjectResult;
import com.ruoyi.system.feign.result.PageHelper;
import feign.Headers;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(
        name = "tenantServiceClient",
        url = "${service.openai.url}"
)
public interface TenantServiceClient {


    @PostMapping("/admin/tenant/find")
    @Headers({"Content-Type: application/json"})
    FeignDataResult<FeignTenantModel> find(@RequestBody PageHelper<FeignTenantModel> search);

    @PostMapping("/admin/tenant/findAll")
    @Headers({"Content-Type: application/json"})
    FeignObjectResult<List<FeignTenantModel>> findAll(@RequestBody FeignTenantModel search);

    @PostMapping("/admin/tenant/save")
    @Headers({"Content-Type: application/json"})
    FeignObjectResult<FeignTenantModel> save(@RequestBody FeignTenantModel model);

    @GetMapping("/admin/tenant/delete/{id}")
    @Headers({"Content-Type: application/json"})
    FeignObjectResult<Boolean> delete(@PathVariable(value = "id") String id);

    @PostMapping("/admin/tenant/update")
    @Headers({"Content-Type: application/json"})
    FeignObjectResult<FeignTenantModel> update(@RequestBody FeignTenantModel model);

    @GetMapping("/admin/tenant/detail/{id}")
    @Headers({"Content-Type: application/json"})
    FeignObjectResult<FeignTenantModel> detail(@PathVariable(value = "id") String id);


    @GetMapping("/admin/tenant/exists")
    @Headers({"Content-Type: application/json"})
    FeignObjectResult<Boolean> exists(@RequestBody FeignTenantModel search);
}
